using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


/// <summary>
/// The EmployeeAddressTableManager class is responsible for managing BO.EmployeeAddressTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class EmployeeAddressTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all EmployeeAddressTable objects in the database.
/// </summary>
/// <returns>A list with all EmployeeAddressTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static EmployeeAddressTableList GetList(){
return EmployeeAddressTableDB.GetList();
}

/// <summary>
/// Gets a single EmployeeAddressTable from the database without its data.
/// </summary>
/// <param name="employeeAddressKey">The EmployeeAddressKey of the EmployeeAddressTable in the database.</param>
/// <returns>A EmployeeAddressTable object when the EmployeeAddressKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EmployeeAddressTable GetItem(int employeeAddressKey){
return GetItem(employeeAddressKey, false);
}

[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EmployeeAddressTable GetItemByUserAccountKey(int UserAccountKey, Int16 AddressTypeCode)
{
    EmployeeAddressTable myTeacherAddressTable = EmployeeAddressTableDB.GetItemByUserAccountKey(UserAccountKey, AddressTypeCode);
    return myTeacherAddressTable;
}


/// <summary>
/// Gets a single EmployeeAddressTable from the database.
/// </summary>
/// <param name="employeeAddressKey">The EmployeeAddressKey of the EmployeeAddressTable in the database.</param>
/// <param name="getEmployeeAddressTableRecords">Determines whether to load all associated EmployeeAddressTable records as well.</param>
/// <returns>
/// A EmployeeAddressTable object when the EmployeeAddressKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EmployeeAddressTable GetItem(int employeeAddressKey, bool getEmployeeAddressTableRecords){
EmployeeAddressTable myEmployeeAddressTable = EmployeeAddressTableDB.GetItem(employeeAddressKey);
return myEmployeeAddressTable;
}

/// <summary>
/// Saves a EmployeeAddressTable in the database.
/// </summary>
/// <param name="myEmployeeAddressTable">The EmployeeAddressTable instance to save.</param>
/// <returns>The new EmployeeAddressKey if the EmployeeAddressTable is new in the database or the existing EmployeeAddressKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(EmployeeAddressTable myEmployeeAddressTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int employeeAddressTableEmployeeAddressKey = EmployeeAddressTableDB.Save(myEmployeeAddressTable);

//  Assign the EmployeeAddressTable its new (or existing EmployeeAddressKey).
myEmployeeAddressTable.EmployeeAddressKey = employeeAddressTableEmployeeAddressKey;

myTransactionScope.Complete();

return employeeAddressTableEmployeeAddressKey;
}
}

/// <summary>
/// Deletes a EmployeeAddressTable from the database.
/// </summary>
/// <param name="myEmployeeAddressTable">The EmployeeAddressTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(EmployeeAddressTable myEmployeeAddressTable){
return EmployeeAddressTableDB.Delete(myEmployeeAddressTable.EmployeeAddressKey);
}

[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(int EmployeeAddressKey)
{
    return EmployeeAddressTableDB.Delete(EmployeeAddressKey);
}

#endregion

}

